rem ##################################################################
rem # EC Development Helper Script
rem # Release 1.0.1
rem ##################################################################

@echo off
cls 

set M2=%M2_HOME%\bin
set MAVEN_OPTS=-Xms256m -Xmx512m

set EC_HOME=%cd%

:menu
echo.
echo ********************************************************************************
echo *                            Batch EC-Background V2.0                          *
echo ********************************************************************************
echo Make your choice:
echo
echo --------------------------------------------------------------------------------
echo  1. Compile all modules under profile local_test
echo  2. Compile all modules under profile cms_test
echo  3. Compile all modules under profile ws_test
echo --------------------------------------------------------------------------------
echo --------------------------------------------------------------------------------
echo  Q. Quit
echo --------------------------------------------------------------------------------
echo.
echo.
echo.
set choice=
set /p choice=Choice:
if not '%choice%'=='' set choice=%choice:~0,2%
if /I %choice%==q goto quitter
if %choice%==1 goto makeAllWithLocalTest
if %choice%==2 goto makeAllWithWsTest
if %choice%==3 goto makeAllWithCmsTest
cls
echo --------------------------------------------------------------------------------
echo Choice not valid: %choice%
echo --------------------------------------------------------------------------------
pause>nul
cls
goto menu

:makeAllWithLocalTest
echo Compiling all module with local_test
set mn=mvn --settings %EC_HOME%\maven\settings\settings-ec.xml -P local_test

cd ec-cms
call %mn% clean
call %mn% compile
call %mn% install

cd ..\ec-ws
call %mn% clean
call %mn% compile
call %mn% install

cd ..\ec-h5
call %mn% clean
call %mn% compile
call %mn% install

echo Finishing compiling all module.....
pause>nul
cls
goto menu

:makeAllWithWsTest
echo Compiling all module with ws_test....
set mn=mvn --settings %EC_HOME%\maven\settings\settings-ec.xml -P ws_test

cd ec-cms
call %mn% clean
call %mn% compile
call %mn% install

cd ..\ec-ws
call %mn% clean
call %mn% compile
call %mn% install

cd ..\ec-h5
call %mn% clean
call %mn% compile
call %mn% install

echo Finishing compiling all module.....
pause>nul
cls
goto menu

:makeAllWithCmsTest
echo Compiling all module with cms_test....
set mn=mvn --settings %EC_HOME%\maven\settings\settings-ec.xml -P cms_test

cd ec-cms
call %mn% clean
call %mn% compile
call %mn% install

cd ..\ec-ws
call %mn% clean
call %mn% compile
call %mn% install

cd ..\ec-h5
call %mn% clean
call %mn% compile
call %mn% install

echo Finishing compiling all module.....
pause>nul
cls
goto menu

:quitter
cd .
echo BYE